package itdep.domain.address;

import itdep.domain.IisEntity;
import itdep.domain.common.Person;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import javax.persistence.*;

/**
 * @author Ivan Khalopik
 * @version $Revision: 10 $ $Date: 2010-06-16 07:13:04 +0000 (Wed, 16 Jun 2010) $
 */
@Entity
@Table(name = "ADDRESS")
public class Address extends IisEntity {

	@Column(name = "ZIP_CODE", nullable = true)
	private String zipCode;

	@Column(name = "BUILDING_NUMBER", nullable = true)
	private String buildingNumber;

	@Column(name = "HOUSE_NUMBER", nullable = true)
	private String houseNumber;

	@Column(name = "FLAT_NUMBER", nullable = true)
	private String flatNumber;

	@Type(type = "ga.hibernate.OrderedEnumUserType", parameters = {@Parameter(name = "enumClass", value = "itdep.domain.address.AddressType")})
	@Column(name = "ADDRESS_TYPE", nullable = false)
	private AddressType addressType;

	@ManyToOne
	@JoinColumn(name = "ID_STREET", nullable = false)
	private Street street;

	@ManyToOne
	@JoinColumn(name = "ID_PERSON", nullable = false)
	private Person person;

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String getBuildingNumber() {
		return buildingNumber;
	}

	public String getHouseNumber() {
		return houseNumber;
	}

	public void setBuildingNumber(String buildingNumber) {
		this.buildingNumber = buildingNumber;
	}

	public void setHouseNumber(String houseNumber) {
		this.houseNumber = houseNumber;
	}

	public String getFlatNumber() {
		return flatNumber;
	}

	public void setFlatNumber(String flatNumber) {
		this.flatNumber = flatNumber;
	}

	public Street getStreet() {
		return street;
	}

	public void setStreet(Street street) {
		this.street = street;
	}

	public AddressType getAddressType() {
		return addressType;
	}

	public void setAddressType(AddressType addressType) {
		this.addressType = addressType;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

}